# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libcroco
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.6.13
pkgrel=2
pkgdesc="A CSS parsing library (mingw-w64)"
arch=('any')
# only needed by librsvg-2.40, so only enabled on arches where that's needed
mingw_arch=('clang32' 'clangarm64')
url="https://www.gnome.org"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-glib2" "${MINGW_PACKAGE_PREFIX}-libxml2")
options=('staticlibs' 'strip')
source=("https://download.gnome.org/sources/libcroco/${pkgver%.*}/${_realname}-${pkgver}.tar.xz")
sha256sums=('767ec234ae7aa684695b3a735548224888132e063f92db585759b422570621d4')

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-$pkgver/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --disable-Bsymbolic
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
  
  local PREFIX_DEPS=$(cygpath -am ${MINGW_PREFIX})
  sed -s "s|${PREFIX_DEPS}|${MINGW_PREFIX}|g" -i ${pkgdir}${MINGW_PREFIX}/bin/croco-${pkgver%.*}-config
}
